home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_squid.idb / usr / freeware / squid / bin / RunCache.z / RunCache
Encoding:
Text File  |  1999-07-16  |  726 b   |  36 lines

  1. #!/bin/sh
  2. #
  3. #  $Id: RunCache.in,v 1.9 1999/01/29 18:19:46 wessels Exp $
  4.  
  5. prefix=/usr/freeware/squid
  6. exec_prefix=${prefix}
  7. logdir=${prefix}
  8. PATH=${exec_prefix}/bin:/bin:/usr/bin
  9. export PATH
  10.  
  11. conf=""
  12. if test "$1" ; then
  13.     conf="-f $1"
  14.     shift
  15. fi
  16.  
  17. failcount=0
  18. while : ; do
  19.     echo "Running: squid -sY $conf >> $logdir/squid.out 2>&1"
  20.     echo "Startup: `date`" >> $logdir/squid.out
  21.     start=`date '+%d%H%M%S'`
  22.     squid -NsY $conf >> $logdir/squid.out 2>&1
  23.     stop=`date '+%d%H%M%S'`
  24.     t=`expr $stop - $start`
  25.     if test 0 -le $t -a $t -lt 5 ; then
  26.         failcount=`expr $failcount + 1`
  27.     else
  28.         failcount=0
  29.     fi
  30.     if test $failcount -gt 5 ; then
  31.               echo "RunCache: EXITING DUE TO REPEATED, FREQUENT FAILURES" >&2
  32.         exit 1
  33.     fi
  34.     sleep 10
  35. done
  36.